<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html>
<head>
<title>Class: tinymce.ui.ListBox</title>
<meta name="generator" content="MoxieDoc" />

<link rel="stylesheet" type="text/css" href="css/reset.css" />
<link rel="stylesheet" type="text/css" href="css/grids.css" />
<link rel="stylesheet" type="text/css" href="css/general.css" />

<script type="text/javascript" src="http://www.google.com/jsapi"></script>
<script type="text/javascript">
	google.load("jquery", "1.3");
</script>
<script type="text/javascript" src="js/jquery.treeview.min.js"></script>
<script type="text/javascript" src="js/general.js"></script>
</head>
<body>
<div class="classDetailsContent">
<h1>tinymce.ui.ListBox</h1>
<table class="classDetails">
<tr>
<td class="first">Namespace</td>
<td class="last">tinymce.ui</td>
</tr>
<tr>
<td class="first">Class</td>
<td class="last">ListBox</td>
</tr>
<tr>
<td class="first">Inheritance</td>
<td class="last inheritageList">
<span>ListBox</span>
<span class="last">
<a href="class_tinymce.ui.Control.html">Control</a>
</span>
</td>
</tr>
<tr>
<td class="first">Subclasses</td>
<td class="last subClassList">
<a href="class_tinymce.ui.NativeListBox.html">NativeListBox</a>
</td>
</tr>
</table>
<div class="classDescription">This class is used to create list boxes/select list. This one will generate
a non native control. This one has the benefits of having visual items added.
</div>
<h4>Example</h4>
<pre class="brush: js;"/>
<div class="summaryLists">
<h2>Public Properties</h2>
<table class="Properties summary">
<thead>
<tr>
<th>Property</th>
<th>Defined By</th>
</tr>
</thead>
<tbody>
<tr>
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.ListBox.html#items">items</a> : Array</div>
<div class="summary">Array of ListBox items.</div>
</td>
<td class="last">ListBox</td>
</tr>
</tbody>
</table>
<h2>Public Methods</h2>
<table class="Methods summary">
<thead>
<tr>
<th>Method</th>
<th>Defined By</th>
</tr>
</thead>
<tbody>
<tr>
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.ListBox.html#ListBox">ListBox</a>(id:String, s:Object, ed:Editor)</div>
<div class="summary">Constructs a new listbox control instance.</div>
</td>
<td class="last">ListBox</td>
</tr>
<tr class="even">
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.ListBox.html#add">add</a>(n:String, v:String, o:Object):void</div>
<div class="summary">Adds a option item to the list box.</div>
</td>
<td class="last">ListBox</td>
</tr>
<tr>
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.ListBox.html#destroy">destroy</a>():void</div>
<div class="summary">Destroys the ListBox i.</div>
</td>
<td class="last">ListBox</td>
</tr>
<tr class="even">
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.ListBox.html#getLength">getLength</a>(Number:Number):void</div>
<div class="summary">Returns the number of items inside the list box.</div>
</td>
<td class="last">ListBox</td>
</tr>
<tr>
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.ListBox.html#hideMenu">hideMenu</a>():void</div>
<div class="summary">Hides the drop menu.</div>
</td>
<td class="last">ListBox</td>
</tr>
<tr class="inherited even">
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.Control.html#isActive">isActive</a>():Boolean</div>
<div class="summary">Returns true/false if the control is disabled or not.</div>
</td>
<td class="last">
<a href="class_tinymce.ui.Control.html">Control</a>
</td>
</tr>
<tr class="inherited">
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.Control.html#isDisabled">isDisabled</a>():Boolean</div>
<div class="summary">Returns true/false if the control is disabled or not.</div>
</td>
<td class="last">
<a href="class_tinymce.ui.Control.html">Control</a>
</td>
</tr>
<tr class="inherited even">
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.Control.html#isRendered">isRendered</a>():Boolean</div>
<div class="summary">Returns true/false if the control has been rendered or not.</div>
</td>
<td class="last">
<a href="class_tinymce.ui.Control.html">Control</a>
</td>
</tr>
<tr>
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.ListBox.html#postRender">postRender</a>():void</div>
<div class="summary">Post render event.</div>
</td>
<td class="last">ListBox</td>
</tr>
<tr class="inherited even">
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.Control.html#remove">remove</a>():void</div>
<div class="summary">Removes the control.</div>
</td>
<td class="last">
<a href="class_tinymce.ui.Control.html">Control</a>
</td>
</tr>
<tr>
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.ListBox.html#renderHTML">renderHTML</a>():String</div>
<div class="summary">Renders the list box as a HTML string.</div>
</td>
<td class="last">ListBox</td>
</tr>
<tr class="even">
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.ListBox.html#renderMenu">renderMenu</a>():void</div>
<div class="summary">Renders the menu to the DOM.</div>
</td>
<td class="last">ListBox</td>
</tr>
<tr class="inherited">
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.Control.html#renderTo">renderTo</a>(n:Element):void</div>
<div class="summary">Renders the control to the specified container element.</div>
</td>
<td class="last">
<a href="class_tinymce.ui.Control.html">Control</a>
</td>
</tr>
<tr class="even">
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.ListBox.html#select">select</a>(va:String/function):void</div>
<div class="summary">Selects a item/option by value.</div>
</td>
<td class="last">ListBox</td>
</tr>
<tr>
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.ListBox.html#selectByIndex">selectByIndex</a>(idx:String):void</div>
<div class="summary">Selects a item/option by index.</div>
</td>
<td class="last">ListBox</td>
</tr>
<tr class="inherited even">
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.Control.html#setActive">setActive</a>(s:Boolean):void</div>
<div class="summary">Sets the activated state for the control.</div>
</td>
<td class="last">
<a href="class_tinymce.ui.Control.html">Control</a>
</td>
</tr>
<tr class="inherited">
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.Control.html#setDisabled">setDisabled</a>(s:Boolean):void</div>
<div class="summary">Sets the disabled state for the control.</div>
</td>
<td class="last">
<a href="class_tinymce.ui.Control.html">Control</a>
</td>
</tr>
<tr class="inherited even">
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.Control.html#setState">setState</a>(c:String, s:Boolean):void</div>
<div class="summary">Sets the specified class state for the control.</div>
</td>
<td class="last">
<a href="class_tinymce.ui.Control.html">Control</a>
</td>
</tr>
<tr>
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.ListBox.html#showMenu">showMenu</a>():void</div>
<div class="summary">Displays the drop menu with all items.</div>
</td>
<td class="last">ListBox</td>
</tr>
</tbody>
</table>
<h2>Public Events</h2>
<table class="Events summary">
<thead>
<tr>
<th>Event</th>
<th>Defined By</th>
</tr>
</thead>
<tbody>
<tr>
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.ListBox.html#onAdd">onAdd</a>()</div>
<div class="summary">Fires when a new item is added.</div>
</td>
<td class="last">ListBox</td>
</tr>
<tr class="even">
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.ListBox.html#onChange">onChange</a>()</div>
<div class="summary">Fires when the selection has been changed.</div>
</td>
<td class="last">ListBox</td>
</tr>
<tr>
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.ListBox.html#onPostRender">onPostRender</a>()</div>
<div class="summary">Fires after the element has been rendered to DOM.</div>
</td>
<td class="last">ListBox</td>
</tr>
<tr class="even">
<td class="first">
<div>
<a class="memberName" href="class_tinymce.ui.ListBox.html#onRenderMenu">onRenderMenu</a>()</div>
<div class="summary">Fires when the menu gets rendered.</div>
</td>
<td class="last">ListBox</td>
</tr>
</tbody>
</table>
</div>
<div class="detailsList">
<div class="details">
<h2>Property details</h2>
<div class="memberDetails last" id="items">
<h3>items<span class="memberType">property</span>
</h3>
<code class="syntax">public items : Array</code>
<div class="memberDescription">Array of ListBox items.
</div>
</div>
</div>
<div class="details">
<h2>Method details</h2>
<div class="memberDetails" id="ListBox">
<h3>ListBox<span class="memberType">constructor</span>
</h3>
<code class="syntax">public 
						function ListBox(id:String, s:Object, ed:Editor)</code>
<div class="memberDescription">Constructs a new listbox control instance.
</div>
<h4>Parameters</h4>
<table class="params">
<tr>
<td class="first">id:String</td>
<td class="last">Control id for the list box.</td>
</tr>
<tr>
<td class="first">s:Object</td>
<td class="last">Optional name/value settings object.</td>
</tr>
<tr>
<td class="first">ed:Editor</td>
<td class="last">Optional the editor instance this button is for.</td>
</tr>
</table>
</div>
<div class="memberDetails" id="add">
<h3>add<span class="memberType">method</span>
</h3>
<code class="syntax">public 
						function add(n:String, v:String, o:Object):void</code>
<div class="memberDescription">Adds a option item to the list box.
</div>
<h4>Parameters</h4>
<table class="params">
<tr>
<td class="first">n:String</td>
<td class="last">Title for the new option.</td>
</tr>
<tr>
<td class="first">v:String</td>
<td class="last">Value for the new option.</td>
</tr>
<tr>
<td class="first">o:Object</td>
<td class="last">Optional object with settings like for example class.</td>
</tr>
</table>
</div>
<div class="memberDetails" id="destroy">
<h3>destroy<span class="memberType">method</span>
</h3>
<code class="syntax">public 
						function destroy():void</code>
<div class="memberDescription">Destroys the ListBox i.e. clear memory and events.
</div>
</div>
<div class="memberDetails" id="getLength">
<h3>getLength<span class="memberType">method</span>
</h3>
<code class="syntax">public 
						function getLength(Number:Number):void</code>
<div class="memberDescription">Returns the number of items inside the list box.
</div>
<h4>Parameters</h4>
<table class="params">
<tr>
<td class="first">Number:Number</td>
<td class="last">of items inside the list box.</td>
</tr>
</table>
</div>
<div class="memberDetails" id="hideMenu">
<h3>hideMenu<span class="memberType">method</span>
</h3>
<code class="syntax">public 
						function hideMenu():void</code>
<div class="memberDescription">Hides the drop menu.
</div>
</div>
<div class="memberDetails" id="postRender">
<h3>postRender<span class="memberType">method</span>
</h3>
<code class="syntax">public 
						function postRender():void</code>
<div class="memberDescription">Post render event. This will be executed after the control has been rendered and can be used to
set states, add events to the control etc. It's recommended for subclasses of the control to call this method by using this.parent().
</div>
</div>
<div class="memberDetails" id="renderHTML">
<h3>renderHTML<span class="memberType">method</span>
</h3>
<code class="syntax">public 
						function renderHTML():String</code>
<div class="memberDescription">Renders the list box as a HTML string. This method is much faster than using the DOM and when
creating a whole toolbar with buttons it does make a lot of difference.
</div>
<h4>Returns</h4>
<div class="returns">String - HTML for the list box control element.</div>
</div>
<div class="memberDetails" id="renderMenu">
<h3>renderMenu<span class="memberType">method</span>
</h3>
<code class="syntax">public 
						function renderMenu():void</code>
<div class="memberDescription">Renders the menu to the DOM.
</div>
</div>
<div class="memberDetails" id="select">
<h3>select<span class="memberType">method</span>
</h3>
<code class="syntax">public 
						function select(va:String/function):void</code>
<div class="memberDescription">Selects a item/option by value. This will both add a visual selection to the
item and change the title of the control to the title of the option.
</div>
<h4>Parameters</h4>
<table class="params">
<tr>
<td class="first">va:String/function</td>
<td class="last">Value to look for inside the list box or a function selector.</td>
</tr>
</table>
</div>
<div class="memberDetails" id="selectByIndex">
<h3>selectByIndex<span class="memberType">method</span>
</h3>
<code class="syntax">public 
						function selectByIndex(idx:String):void</code>
<div class="memberDescription">Selects a item/option by index. This will both add a visual selection to the
item and change the title of the control to the title of the option.
</div>
<h4>Parameters</h4>
<table class="params">
<tr>
<td class="first">idx:String</td>
<td class="last">Index to select, pass -1 to select menu/title of select box.</td>
</tr>
</table>
</div>
<div class="memberDetails last" id="showMenu">
<h3>showMenu<span class="memberType">method</span>
</h3>
<code class="syntax">public 
						function showMenu():void</code>
<div class="memberDescription">Displays the drop menu with all items.
</div>
</div>
</div>
<div class="details">
<h2>Event details</h2>
<div class="memberDetails" id="onAdd">
<h3>onAdd<span class="memberType">event</span>
</h3>
<code class="syntax">public 
						event onAdd()</code>
<div class="memberDescription">Fires when a new item is added.
</div>
</div>
<div class="memberDetails" id="onChange">
<h3>onChange<span class="memberType">event</span>
</h3>
<code class="syntax">public 
						event onChange()</code>
<div class="memberDescription">Fires when the selection has been changed.
</div>
</div>
<div class="memberDetails" id="onPostRender">
<h3>onPostRender<span class="memberType">event</span>
</h3>
<code class="syntax">public 
						event onPostRender()</code>
<div class="memberDescription">Fires after the element has been rendered to DOM.
</div>
</div>
<div class="memberDetails last" id="onRenderMenu">
<h3>onRenderMenu<span class="memberType">event</span>
</h3>
<code class="syntax">public 
						event onRenderMenu()</code>
<div class="memberDescription">Fires when the menu gets rendered.
</div>
</div>
</div>
</div>
</div>
</body>
</html>
